package com.neu.model

import spray.json.{ DefaultJsonProtocol, _ }

object VulnerabilityJsonProtocol extends DefaultJsonProtocol {
  implicit val vulnerabilityProfileEntryFormat: RootJsonFormat[VulnerabilityProfileEntry] =
    jsonFormat6(
      VulnerabilityProfileEntry
    )
  implicit val vulnerabilityProfileFormat: RootJsonFormat[VulnerabilityProfile] = jsonFormat2(
    VulnerabilityProfile
  )
  implicit val vulnerabilityProfilesDataFormat: RootJsonFormat[VulnerabilityProfilesData] =
    jsonFormat1(
      VulnerabilityProfilesData
    )
  implicit val vulnerabilityProfileConfigFormat: RootJsonFormat[VulnerabilityProfileConfig] =
    jsonFormat2(
      VulnerabilityProfileConfig
    )
  implicit val vulnerabilityProfileConfigDataFormat
    : RootJsonFormat[VulnerabilityProfileConfigData] = jsonFormat1(
    VulnerabilityProfileConfigData
  )
  implicit val vulnerabilityProfileEntryConfigDataFormat
    : RootJsonFormat[VulnerabilityProfileEntryConfigData] = jsonFormat1(
    VulnerabilityProfileEntryConfigData
  )

  def vulnerabilityProfileConfigDataToJson(config: VulnerabilityProfileConfigData): String =
    config.toJson.compactPrint
  def vulnerabilityProfileEntryConfigDataToJson(
    config: VulnerabilityProfileEntryConfigData
  ): String =
    config.toJson.compactPrint
  def vulnerabilityProfileEntryToJson(
    vulnerabilityProfileEntry: VulnerabilityProfileEntry
  ): String =
    vulnerabilityProfileEntry.toJson.compactPrint
}
